<template>
  <div id="agreement">
    <div class="inner">
      <div class="title">{{ agreementTitle }}</div>
      <div class="content">
        <div v-for="(item, index) in contentList" :class="['items', indexList.includes(index) ? 'mt-30' : '']"
          :key="item">
          {{ item }}
        </div>
      </div>
      <div class="party">
        <div class="party-a">
          <div class="ft">
            <span>甲方：方田教育</span>
          </div>
          <div class="date">
            <span>日期：</span>
            <span> {{ resumeInfo.currentDay }}</span>
          </div>
          <img src="@/assets/img/seal.png" alt="" srcset="" />
        </div>
        <div class="party-b">
          <div class="ft">
            <div class="sign">
              <span>乙方：</span>
              <!-- v-show="!signature" -->
              <!-- <span class="start-sign" v-show="!signature"></span> -->
              <img :src="signature" class="sign-img" alt="" />
            </div>
          </div>
          <div class="date">
            <span>日期：</span>
            <span> {{ resumeInfo.joinTrainingTime }}</span>
          </div>
        </div>
      </div>
      <!-- <a-button type="primary" class="sub-btn" @click="!signature ? startSignature() : dosub()">
        {{ !signature ? '点击签字' : '确定' }}
      </a-button> -->
    </div>
  </div>

  <!-- <commonModal title="按住鼠标在下方区域签名" ref="myModal">
    <template #default>
      <vueEsign class="esign" ref="esign" :height="502" />
      <div class="btn-area">
        <div class="btns" @click="reset">清除重写</div>
        <div class="btns" @click="comfirm">提交签字</div>
      </div>
    </template>
</commonModal> -->
  <ElBacktop :bottom="100" :right="200" target="#agreement" class="back-top">
    <img src="@/assets/img/join/toTop.png" alt="" srcset="" />
  </ElBacktop>
</template>

<script setup lang="ts">
import commonModal from '../index/commonModal.vue';
import Agreement from '../../components/Agreement.vue';
import type { Rule } from 'ant-design-vue/es/form';
import { message } from 'ant-design-vue';
import MealsModal from '../index/MealsModal.vue';
import apis from "../../api/index";
import { ElBacktop } from 'element-plus';
const { uploadTrainingAgreement, joinTrainingNumber } = apis;
import { useStore } from '@/store';
const store = useStore();
const { resumeInfo, resumeProcess } = store as any;
const router = useRouter();
const route = useRoute();
const query = route.query as any;
const { trainingNumberId, resumesId, timeRange } = query
const startDate = ref<string>('6月9日');
const endDate = ref<string>('6月12日');
const myModal = ref<typeof commonModal>(commonModal);
const signature = ref<string>('');
signature.value = resumeInfo.trainingUrl;;
const contentList = ref<string[]>([
  '甲方（提供培训方）：方田教育',
  `乙方（接受培训方）：${resumeInfo.userName}`,
  `联系方式：${resumeInfo.phone}`,
  `地址：安徽省合肥市蜀山区怀宁路288号置地广场A座`,
  `身份证号码：${resumeInfo.certificateNumber}`,
  '为帮助乙方快速提升教学能力、掌握教师岗位必备工作技能，甲方特组织新田计划特训营，由甲方对乙方进行候选人教学能力培训，经甲、乙双方充分协商，自愿达成如下共识，特订立本协议，以资恪守。',
  '一、培训时间',
  `${timeRange}`,
  '乙方逾期未参加培训视为乙方自动放弃，乙方若因不可抗力不能按期参加培训，另行协商解决。',
  '二、培训地点',
  '安徽省合肥市',
  '三、培训费用',
  '特训营期间课程及师资费用，交通住宿及餐饮均由甲方提供，不向乙方收取其他任何费用。',
  '四、甲方的权利和义务:',
  '4.1 甲方负责提供培训场地、设备设施、培训课程等用于开展培训；',
  '4.2 甲方设置培训内容、安排培训日程、组织培训活动、进行培训考核；',
  '4.3 甲方对乙方在培训活动之外的行为不承担责任。',
  '五、乙方的权利和义务',
  '5.1 培训期间，乙方须接受甲方的各项管理规定，遵守培训纪律，如有违反，甲方可对乙方提出劝退，提前结束对乙方的培训：',
  '5.2 乙方在培训期间未经甲方允许，不得私自外出，由此产生的一切后果及造成的任何安全事故、意外事件，均由乙方自行全部承担，与甲方无关，由此造成甲方相关损失的，由乙方全部承担，涉及到相关法律法规的，将追究其相关法律法规责任。',
  '5.3 甲方提供的内部教材、知识产权和软件系统等仅限培训期间乙方本人使用，未经甲方同意，乙方不得以任何形式或载于任何载体，以口头、图像或书面等方式向第三方披露。如违反此条款给甲方造成任何损失，乙方应承担赔偿责任。',
  '六、其他',
  '1.乙方若因自身原因放弃或中途退出培训，视为乙方自愿放弃参与新田计划特训营、自愿放弃候选人身份；',
  '2.本协议一式贰份，甲、乙双方各执壹份；',
  '3.本协议自甲乙双方签字盖章之日起生效，培训结束或乙方因故退出时，协议自动终止。',
  '4.本协议未尽事宜，甲、乙双方共同协商解决。',
]);
const agreementTitle = ref<string>('方田教育新田计划特训营培训协议');
const indexList = ref<number[]>([6, 9, 11, 13, 17, 21]);

const trainingUrl = ref<string>("");

</script>

<style lang="scss" scoped>
#agreement {
  width: 100vw;
  height: calc(100vh - 72px);
  margin-top: 72px;
  overflow: auto;
  box-sizing: border-box;
  color: #333;
  padding-top: 20px;
  box-sizing: border-box;
  overflow: auto;

  .inner {
    padding: 40px;
    box-sizing: border-box;
    width: 1200px;
    background: #fff;
    margin: 0 auto;
    border-radius: 12px;
    position: relative;
    min-height: 85vh;
  }
}

.title {
  width: 100%;
  height: 40px;
  opacity: 1;
  font-size: 18px;
  font-weight: normal;
  line-height: 25px;
  text-align: center;
  letter-spacing: 0em;
  font-variation-settings: 'opsz' auto;
  color: #212121;
}

.content {
  .items {
    margin-top: 5px;
  }
}

.mt-30 {
  margin-top: 30px !important;
}

.btn-area {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;

  .btns {
    line-height: 40px;
    text-align: center;
    color: #fff;
    width: 120px;
    height: 40px;
    background: #209ee4;
    border-radius: 8px;
    cursor: pointer;

    &:nth-child(1) {
      margin-right: 20px;
      color: #f56c56;
      background: #f5f7fb;
      border: 1px solid #b3c0c8;
    }
  }
}

.back {
  position: absolute;
  top: 30px;
  left: 30px;
  display: flex;
  color: #333;
  font-size: 16px;
  display: flex;
  align-items: center;

  span {
    margin-left: 10px;
  }
}

.sign {
  display: flex;
  height: 70px;
  align-items: center;

  .start-sign {
    // color: #409eff;
    width: 173px;
    height: 30px;
    background: #f4f6f8;
    border-radius: 5px;
  }

  .sign-img {
    margin-left: 20px;
    width: 130px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }
}

.party {
  display: flex;
  justify-content: space-between;
}

.party-a {
  // margin: 24px 0;
  margin-top: 24px;
  line-height: 26px;
  position: relative;

  img {
    width: 70px;
    position: absolute;
    left: 55%;
    top: -10%;
  }
}

.date {
  span {
    &:nth-child(2n) {
      text-decoration: underline;
      margin: 0 5px;
    }
  }
}

.sub-btn {
  border-radius: 5px;
  text-align: center;
  color: #fff;
  font-size: 14px;
  margin: 0 auto;
  margin-bottom: 10px;
  margin-top: 20px;
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);

  span {
    font-size: 14px !important;
  }
}

.back-top {
  img {
    width: 40px;
    height: 40px;
  }
}

.esign {
  position: relative;
  z-index: 100;
  background: #f5f7fb !important;
}
</style>
